<template>
  <div class='top-num-container'>
    <div class='main'>
      <div class='top'>
        <p class='title'>{{ title }}</p>
      </div>
      <div class='mid' :style='{color: valueColor}'>
        <a-statistic :value='newValue' :precision='2'
                     :valueStyle='"color:" + valueColor + ";font-weight: 600;font-size: 30px !important;"' />
        <p style='padding-top: 15px'> {{ unit }}</p>
      </div>
      <div class='bottom'>
        <p class='last-num'>
          <span>上月同期：</span>
          <a-statistic :value='oldValue' :precision='2'
                       :valueStyle='"font-size: 16px; margin-top:-2px; color: rgb(155, 160, 152);"' />
          {{ unit }}
        </p>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  props: {
    title: String,
    unit: String,
    newValue: String,
    img: String,
    oldValue: String,
    valueColor: String,
    upOrDown: Boolean,
    percentage: String
  }
}
</script>

<style lang='less' scoped>
span {
  white-space: nowrap;
}

.top-num-container {
  height: 100%;
  display: flex;
  justify-content: space-between;

  .main {
    width: 100%;
    display: flex;
    flex-direction: column;
    justify-content: space-between;

    .top {
      font-weight: bold;
      display: flex;
      justify-content: space-between;

      .title {
        font-size: 18px;
      }
    }

    .mid {
      display: flex;
      justify-content: flex-end;
    }

    .bottom {
      height: 20px;
      display: flex;
      justify-content: space-between;

      .last-num {
        display: flex;
        color: rgb(155, 160, 152) !important;
      }
    }
  }

  /deep/ .ant-statistic-content-value-decimal {
    font-size: inherit;
  }
}
</style>